home *** CD-ROM | disk | FTP | other *** search
/ Virtual Graceland / Virtual Graceland (1996)(Highway One)(Disc 2 of 2)[Mac-PC].iso / mac / GRACELND / SHARED.DXR / 02370_Field_2370.txt < prev    next >
Text File  |  1996-07-31  |  2KB  |  92 lines

  1. -- Roll over object, Dave Code
  2.  
  3. property mySprite, rollCast, actorNum, birthFrame, visState, myLoc
  4.  
  5. --  append( rollerList, birth( script "rollOverParent", 18, gCastStart))
  6. --  actUp getat(rollerList,1)
  7.  
  8. on birth me, sNum, rCast
  9.   global gNullChannel
  10.   set myLoc = the loc of sprite gNullChannel
  11.   set mySprite = sNum
  12.   set visState = 0
  13.   set rollCast = rCast
  14.   set birthframe = the frame
  15.   return me
  16. end
  17.  
  18. on checkRoll me
  19.   global gNullChannel
  20.   if rollover(mySprite) and visState  = 0 and the puppet of sprite gNullChannel = 0 then
  21.     put "rollUp"
  22.     puppetSprite gNullChannel, 1
  23.     set the loc of sprite gNullChannel = myLoc
  24.     set the castnum of sprite gNullChannel = rollCast
  25.     updatestage
  26.     set visState = 1
  27.   else
  28.     if not rollover(mySprite) and visState = 1 and the puppet of sprite gNullChannel = 1 then
  29.       put "rollDown"
  30.       set the loc of sprite gNullChannel = point(-500,-500)
  31.       updatestage
  32.       puppetSprite gNullChannel, 0 
  33.       set visState = 0
  34.     end if
  35.   end if
  36.   
  37. end
  38.  
  39. on stepFrame me
  40.   global rollerlist
  41.   checkRoll
  42.   if the frame > birthframe + 2 or the frame < birthframe  then
  43.     actDown me
  44.   end if
  45. end
  46.  
  47. on actUp me
  48.   append(the actorlist, me)
  49. end
  50.  
  51. on actDown me
  52.   killObj me
  53. end
  54.  
  55. on rollerInit
  56.   global gRollStart, gRollCount, gNullChannel, gCastStart, rollerlist
  57.   
  58.   if objectP(Rollerlist) then
  59.     repeat with i = 1 to count(rollerList)
  60.       actDown getAt(rollerList, i)
  61.     end repeat
  62.   end if
  63.   puppetSprite gNullChannel, 0
  64.   set rollerlist = []
  65.   repeat with i = 0 to gRollCount - 1
  66.     append( rollerList, birth( script "rollOverParent", gRollStart + i, gCastStart + i))
  67.     actUp getat(rollerList,i + 1)
  68.   end repeat
  69.   
  70. end
  71.  
  72. on killObj theObj
  73.   set mynum =  getPos(the actorlist, theobj) -- into myNum
  74.   if myNum > 0 then
  75.     put getat(the actorlist, myNum) into temp
  76.     put "My Actor is" & myNum
  77.     deleteAt the actorlist, myNum
  78.   end if
  79. end
  80. on exitFrame
  81.   global gRollStart, gRollCount, gNullChannel, gCastStart
  82.   global gRoom, gBkgndRandomCount, rollerlist
  83.   
  84.   set gRollStart = 18
  85.   set gRoom = "PA"
  86.   set gRollCount = 4
  87.   set gCastStart = the number of cast "PAtoBAbtn"
  88.   set gBkgndRandomCount = 1
  89.   -- Dave code
  90.   rollerInit  
  91. end 
  92.